package com.example.mapper;

import com.example.pojo.Emp;
import com.example.pojo.EmpQueryParam;
import com.example.service.EmpService;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@Mapper
public interface EmpMapper {
//    @Select("select count(*) from emp e left join dept d on e.dept_id = d.id")
//    public Long count();
//    @Select("select e.*, d.name deptName from emp e left join dept d on e.dept_id = d.id " +
//            "ORDER BY e.update_time desc limit #{start}, #{pageSize}")
//    public List<Emp> list(Integer start,Integer pageSize);
//    @Select("select e.*, d.name deptName from emp e left join dept d on e.dept_id = d.id ORDER BY e.update_time desc ")

    //条件分页查询员工信息
    public List<Emp> list(EmpQueryParam empQueryParam);
    //增加员工基本信息
    @Options(useGeneratedKeys = true,keyProperty = "id")
    void insert(Emp emp);
    //批量删除员工基本信息
    void deleteById(List<Integer> ids);
    //根据id查询员工基本信息和工作经历
    Emp getInfo(Integer id);
    //修改员工基本信息
    void updateById(Emp emp);
    //统计各个职位的员工人数
    List<Map<String,Object>> countEmpJobData();
//    统计员工性别人数
    List<Map> countEmpGenderData();
    //员工登录
    @Select("select * from emp where username=#{username} and password=#{password}")
    Emp getUsernameAndPassword(Emp emp);
}
